<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:65:"/www/wwwroot/xunda-college/application/atxunda/view/user/vip.html";i:1700617177;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;s:71:"/www/wwwroot/xunda-college/application/atxunda/view/user/nav_price.html";i:1701077254;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<style type="text/css">
	.input_price{width: 8%;}
	.input_remarks{width: 50%}
	.hide{display: none;}
	.input_type{width:50%;padding: 10px;border-radius: 5px;border: 1px solid #ddd;margin-bottom: 15px;}
</style>
<body>
	<div class="panel admin-panel margin-top" id="add">
		<div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容</strong></div>
		<div class="body-content">
			<form method="post" class="form-x" action=""  enctype="multipart/form-data">
				<div class="form-group">
					<div class="label">
						<label>手机号：</label>
					</div>
					<div class="label" style="width:5%;overflow:inherit">
						<label><?php echo !empty($data['know_phone'])?$data['know_phone']: $data['know_email']; ?></label>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>选择身份：</label>
					</div>
					<div class="field">
						<div class="button-group radio">
							<input name="status" value="1" type="radio" <?php if($status == 1): ?>  checked="checked" <?php endif; ?> class="radio_status">超级会员
							<input name="status" value="2"  type="radio" <?php if($status == 2): ?>  checked="checked" <?php endif; ?> class="radio_status">单课程
							<input name="status" value="0" type="radio" <?php if($status == 0): ?>  checked="checked" <?php endif; ?> class="radio_status">取消身份
						</label>
					</div>
				</div>
			</div>
			<div class="form-group nav_price" <?php if($status == 1): ?>style="display:none;"<?php endif; ?>>
	<div class="label">
		<label>选择套餐：</label>
	</div>
	<div class="field" style="padding-top:8px;"> 
		<?php foreach($navData as $k=>$nav): ?>
		<?php echo $nav['nav_name']; ?> 
		<input  type="checkbox" class="nav" name="nav_id[<?php echo $k; ?>]" value="<?php echo $nav['nav_id']; ?>" <?php if($vips[2][$nav['nav_id']]): ?>checked=''<?php endif; ?>/>
		<input type="text" class="<?php echo $nav['inputs']; ?> input_vip<?php echo $nav['nav_id']; ?> input_money<?php echo $nav['nav_id']; ?>" placeholder="价格" readonly="" value="<?php echo $nav['nav_price']; ?>">
		<input type="text" name="money[<?php echo $k; ?>]" class="<?php echo $nav['inputs']; ?> input_vip<?php echo $nav['nav_id']; ?>" placeholder="实缴金额(必填)" value="<?php echo $nav['nav_price']; ?>">
		<select name="pack_id[<?php echo $k; ?>]" class="<?php echo $nav['inputs']; ?> input_vip<?php echo $nav['nav_id']; ?> input_package" data-id="<?php echo $nav['nav_id']; ?>">
			<?php foreach($nav['package'] as $pk=>$pack): ?>
			<option value="<?php echo $pack['id']; ?>" <?php if($nav['userPack']['pack_id'] == $pack['id'] || $pack['id'] == 2): ?>selected=""<?php endif; ?> data-money="<?php echo $nav['moneys'][$pack['id']]; ?>"><?php echo $pack['title']; ?></option>
			<?php endforeach; ?>
		</select>
		<dl id="dl<?php echo $k; ?>" style="margin-left:10px;width: 300px;" class="<?php echo $nav['inputs']; ?> input_vip<?php echo $nav['nav_id']; ?>">
		<?php foreach($nav['type'] as $kt=>$type): ?>
		<dd style="margin-left:10px;" ><input type="checkbox" name="type_id[<?php echo $nav['nav_id']; ?>][]" value="<?php echo $kt; ?>" class="<?php echo $nav['inputs']; ?> input_vip<?php echo $nav['nav_id']; ?> dds<?php echo $k; ?>" id="dd<?php echo $k; ?><?php echo $kt; ?>" onclick="checkdt(<?php echo $k; ?>,<?php echo $kt; ?>)" <?php if($vips[2][$nav['nav_id']]['type_id'] && in_array($kt, explode(',',$vips[2][$nav['nav_id']]['type_id']))): ?>checked=""<?php endif; ?>/>&nbsp;&nbsp;<?php echo $type; ?></dd>
		<?php endforeach; ?>
		</dl>
		<br>
		<?php endforeach; ?>
	</div>
</div>
			<div class="form-group nav_year">
				<div class="label">
					<label>会员年限：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" style="width: 340px;" value="<?php echo $user_vip['year']; ?>" name="year" placeholder="默认不填(超级会员默认是10 单课程默认是2)" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label></label>
				</div>
				<div class="field">
					<button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
</body></html>
<script type="text/javascript">
	$('.nav').click(function(){
		var nav_id = $(this).val();
		if($(this).is(':checked') == true){
			$('.input_vip'+nav_id).show();
			$('.input_br'+nav_id).show();
		}else{
			$('.input_vip'+nav_id).hide();
			$('.input_br'+nav_id).hide();
		}
	});
	$('.radio_status').click(function(){
		var show = $('input:radio[name="status"]:checked').val();
		$('.nav_price').hide();
		$('.nav_year').show();
		if(show == 0) $('.nav_year').hide();
		$('.user_vip').hide();
		if(show == 1){
			$('.user_type').show();
		}else if(show != 0){
			$('.nav_price').show();
			if(show == 5) $('.user_type').show();
		}
	});
	$('.types').click(function(){
		$('.input_type').hide();
		if($(this).is(':checked') == true) $(this).next().show();
	});
	$('.class_nav input').click(function(){
		if($(this).is(':checked') == true) {
			var nav_id = $(this).parent().data('id');
			var study_num = $('.input_study'+nav_id).val();
			study_num = study_num ? study_num+','+$(this).data('study') : $(this).data('study');
			$('.input_study'+nav_id).val(study_num);
		}
	});
	$('.input_package').change(function(){
		var money = $(this).find("option:selected").data('money');
		var nav_id = $(this).data('id');
		$('.input_money'+nav_id).val(money);
	});
	$(document).ready(function(){
		var class_nav = $('.class_nav');
		for (var i = class_nav.length - 1; i >= 0; i--) {
			console.log(i);
			var nav_id = $(class_nav[i]).data('id');
			console.log(nav_id);
			var study = $(class_nav[i]).find("input");
			var study_num = [];
			if(study) for (var is = 0; is < study.length ; is++) {
				if($(study[is]).prop('checked')) study_num.push($(study[is]).data('study'));
			}
			if(study_num){
				$('.input_study'+nav_id).val(study_num.join());
			}
		}
	});
	
</script>